****************
*** Fig. B.3 ***
****************
* load frame
frame change comparative_data

* approve the EU, dummy economic performance

reg EU_approv ///
	i.income_loss##i.declining##c.region_talk_pol ///
	i.class2 i.class3 ///
	i.not_working ///
	age ///
	i.edu2 i.edu3 i.edu4 i.edu5 ///
	i.gender ///
	i.cntryn ///
	, ///
		cluster(region_iso2)
		
margins declining, dydx(income_loss) at(region_talk_pol=(30(10)70))
mplotoffset,  offset(0.5) recast(scatter) ///
	title("") ///
	ytitle("Approve the EU", size(large)) ///
	xtitle("People who talk politics", size(large)) ///		
	yline(0, lw(thin) lstyle(foreground) ) ///
	ylabel(, grid glcolor(black%70) glw(thin) labs(medl)) ///
	xlabel(, nogrid) ///
	aspect(1) ///
	plot1opts(msymbol(D) msize(medium) mcolor(red) lcolor(red) lwidth(medthick)) ci1opts(lcolor(red)) ///
	plot2opts(msymbol(O) msize(medium) mcolor(blue) lp(solid)  mlcolor(blue) lcolor(blue) lwidth(medthick)) ci2opts(lcolor(blue)) ///
	legend( ///
		region(lwidth(none)) ///
		col(2) ///
		position(6) ///
		order(3 "Growing region" 4 "Declining region"))
		
graph addplot histogram region_talk_pol, ///
	yaxis(2) ///
	yscale(range(0 0.5) off axis(2)) ///
	xlabel(10(10)80) ///
	color(black%10) ///
	legend( ///
		order(3 "Growing region" 4 "Declining region"))

graph export "$folder/replication/figures/figB3a.pdf", replace

* Vote to disapprove the EU, dummy economic performance

reg vote_disapprove_EU ///
	i.income_loss##i.declining##c.region_talk_pol ///
	i.class2 i.class3 ///
	i.not_working ///
	age ///
	i.edu2 i.edu3 i.edu4 i.edu5 ///
	i.gender ///
	i.cntryn ///
	, ///
		cluster(region_iso2)
		
margins declining, dydx(income_loss) at(region_talk_pol=(30(10)70))
mplotoffset,  offset(0.5) recast(scatter) ///
	title("") ///
	ytitle("Vote to disapprove the EU", size(large)) ///
	xtitle("People who talk politics", size(large)) ///		
	yline(0, lw(thin) lstyle(foreground) ) ///
	ylabel(, grid glcolor(black%70) glw(thin) labs(medl)) ///
	xlabel(, nogrid) ///
	aspect(1) ///
	plot1opts(msymbol(D) msize(medium) mcolor(red) lcolor(red) lwidth(medthick)) ci1opts(lcolor(red)) ///
	plot2opts(msymbol(O) msize(medium) mcolor(blue) lp(solid)  mlcolor(blue) lcolor(blue) lwidth(medthick)) ci2opts(lcolor(blue)) ///
	legend( ///
		region(lwidth(none)) ///
		col(2) ///
		position(6) ///
		order(3 "Growing region" 4 "Declining region"))
		
graph addplot histogram region_talk_pol, ///
	yaxis(2) ///
	yscale(range(0 0.5) off axis(2)) ///
	xlabel(10(10)80) ///
	color(black%10) ///
	legend( ///
		order(3 "Growing region" 4 "Declining region"))

	graph export "$folder/replication/figures/figB3b.pdf", replace

* approve the EU, above/below median economic performance
	
reg EU_approv ///
	i.income_loss##i.below_median_growth##c.region_talk_pol ///
	i.class2 i.class3 ///
	i.not_working ///
	age ///
	i.edu2 i.edu3 i.edu4 i.edu5 ///
	i.gender ///
	i.cntryn ///
	, ///
		cluster(region_iso2)
		
margins below_median_growth, dydx(income_loss) at(region_talk_pol=(30(10)70))
mplotoffset,  offset(0.5) recast(scatter) ///
	title("") ///
	ytitle("Approve the EU", size(large)) ///
	xtitle("People who talk politics", size(large)) ///		
	yline(0, lw(thin) lstyle(foreground) ) ///
	ylabel(, grid glcolor(black%70) glw(thin) labs(medl)) ///
	xlabel(, nogrid) ///
	aspect(1) ///
	plot1opts(msymbol(D) msize(medium) mcolor(red) lcolor(red) lwidth(medthick)) ci1opts(lcolor(red)) ///
	plot2opts(msymbol(O) msize(medium) mcolor(blue) lp(solid)  mlcolor(blue) lcolor(blue) lwidth(medthick)) ci2opts(lcolor(blue)) ///
	legend( ///
		region(lwidth(none)) ///
		col(2) ///
		position(6) ///
		order(3 "Above median growth" 4 "Below median growth"))
		
graph addplot histogram region_talk_pol, ///
	yaxis(2) ///
	yscale(range(0 0.5) off axis(2)) ///
	xlabel(10(10)80) ///
	color(black%10) ///
	legend( ///
		order(3 "Above median growth" 4 "Below median growth"))

graph export "$folder/replication/figures/figB3c.pdf", replace

* Vote to disapprove the EU, above/below median economic performance

reg vote_disapprove_EU ///
	i.income_loss##i.below_median_growth##c.region_talk_pol ///
	i.class2 i.class3 ///
	i.not_working ///
	age ///
	i.edu2 i.edu3 i.edu4 i.edu5 ///
	i.gender ///
	i.cntryn ///
	, ///
		cluster(region_iso2)
		
margins below_median_growth, dydx(income_loss) at(region_talk_pol=(30(10)70))
mplotoffset,  offset(0.5) recast(scatter) ///
	title("") ///
	ytitle("Vote to disapprove the EU", size(large)) ///
	xtitle("People who talk politics", size(large)) ///		
	yline(0, lw(thin) lstyle(foreground) ) ///
	ylabel(, grid glcolor(black%70) glw(thin) labs(medl)) ///
	xlabel(, nogrid) ///
	aspect(1) ///
	plot1opts(msymbol(D) msize(medium) mcolor(red) lcolor(red) lwidth(medthick)) ci1opts(lcolor(red)) ///
	plot2opts(msymbol(O) msize(medium) mcolor(blue) lp(solid)  mlcolor(blue) lcolor(blue) lwidth(medthick)) ci2opts(lcolor(blue)) ///
	legend( ///
		region(lwidth(none)) ///
		col(2) ///
		position(6) ///
		order(3 "Above median growth" 4 "Below median growth"))
		
graph addplot histogram region_talk_pol, ///
	yaxis(2) ///
	yscale(range(0 0.5) off axis(2)) ///
	xlabel(10(10)80) ///
	color(black%10) ///
	legend( ///
		order(3 "Above median growth" 4 "Below median growth"))

graph export "$folder/replication/figures/figB3d.pdf", replace

* approve the EU, three categories economic performance

reg EU_approv ///
	i.income_loss##i.growth_three##c.region_talk_pol ///
	i.class2 i.class3 ///
	i.not_working ///
	age ///
	i.edu2 i.edu3 i.edu4 i.edu5 ///
	i.gender ///
	i.cntryn ///
	, ///
		cluster(region_iso2)
		
margins growth_three, dydx(income_loss) at(region_talk_pol=(30(10)70))
mplotoffset,  offset(0.5) recast(scatter) ///
		title("") ///
		ytitle("Approve the EU", size(large)) ///
		xtitle("People who talk politics", size(large)) ///		
		yline(0, lw(thin) lstyle(foreground) ) ///
		ylabel(, grid glcolor(black%70) glw(thin) labs(medl)) ///
		xlabel(, nogrid) ///
		aspect(1) ///
		plot3opts(msymbol(D) msize(medium) mcolor(red) lcolor(red) lwidth(medthick)) ci3opts(lcolor(red)) ///
		plot2opts(msymbol(O) msize(medium) mcolor(orange) lp(solid)  mlcolor(orange) lcolor(orange) lwidth(medthick)) ci2opts(lcolor(orange)) ///
		plot1opts(msymbol(O) msize(medium) mcolor(blue) lp(solid)  mlcolor(blue) lcolor(blue) lwidth(medthick)) ci1opts(lcolor(blue)) ///
		legend( ///
			region(lwidth(none)) ///
			col(3) ///
			position(6) ///
			order(4 "GDP growth < 0" 5 "GDP growth 0-2" 6 "GDP growth > 2"))
graph addplot histogram region_talk_pol, ///
	yaxis(2) ///
	yscale(range(0 0.5) off axis(2)) ///
	xlabel(10(10)80) ///
	color(black%10) ///
	legend( ///
		order(4 "GDP growth < 0" 5 "GDP growth 0-2" 6 "GDP growth > 2"))

graph export "$folder/replication/figures/figB3e.pdf", replace
	
* Vote to disapprove the EU, three categories economic performance

reg vote_disapprove_EU ///
	i.income_loss##i.growth_three##c.region_talk_pol ///
	i.class2 i.class3 ///
	i.not_working ///
	age ///
	i.edu2 i.edu3 i.edu4 i.edu5 ///
	i.gender ///
	i.cntryn ///
	, ///
		cluster(region_iso2)
		
margins growth_three, dydx(income_loss) at(region_talk_pol=(30(10)70))
mplotoffset,  offset(0.5) recast(scatter) ///
		title("") ///
		ytitle("Vote to disapprove the EU", size(large)) ///
		xtitle("People who talk politics", size(large)) ///		
		yline(0, lw(thin) lstyle(foreground) ) ///
		ylabel(, grid glcolor(black%70) glw(thin) labs(medl)) ///
		xlabel(, nogrid) ///
		aspect(1) ///
		plot3opts(msymbol(D) msize(medium) mcolor(red) lcolor(red) lwidth(medthick)) ci3opts(lcolor(red)) ///
		plot2opts(msymbol(O) msize(medium) mcolor(orange) lp(solid)  mlcolor(orange) lcolor(orange) lwidth(medthick)) ci2opts(lcolor(orange)) ///
		plot1opts(msymbol(O) msize(medium) mcolor(blue) lp(solid)  mlcolor(blue) lcolor(blue) lwidth(medthick)) ci1opts(lcolor(blue)) ///
		legend( ///
			region(lwidth(none)) ///
			col(3) ///
			position(6) ///
			order(4 "GDP growth < 0" 5 "GDP growth 0-2" 6 "GDP growth > 2"))
graph addplot histogram region_talk_pol, ///
	yaxis(2) ///
	yscale(range(0 0.5) off axis(2)) ///
	xlabel(10(10)80) ///
	color(black%10) ///
	legend( ///
		order(4 "GDP growth < 0" 5 "GDP growth 0-2" 6 "GDP growth > 2"))

graph export "$folder/replication/figures/figB3f.pdf", replace
